const myChart = echarts.init(document.getElementById('main'));
option = {
    title: {
        text: '国家间贸易关系'
    },
    tooltip: {
        trigger: 'item',
        formatter: function (params, ticket, callback) {
            if (params.dataType === 'edge') {
                return params.data.source + ' -> ' + params.data.target + '<br/>贸易额: ' + params.data.weight;
            } else {
                return params.data.name;
            }
        }
    },
    series: [
        {
            type: 'chord',
            data: [
                {name: '中国'},
                {name: '美国'},
                {name: '英国'},
                {name: '日本'},
                {name: '德国'}
            ],
            links: [
                {source: '中国', target: '美国', weight: 500, name: '贸易额'},
                {source: '美国', target: '中国', weight: 400, name: '贸易额'},
                {source: '中国', target: '日本', weight: 300, name: '贸易额'},
                {source: '日本', target: '中国', weight: 200, name: '贸易额'},
                {source: '美国', target: '英国', weight: 150, name: '贸易额'},
                {source: '英国', target: '美国', weight: 100, name: '贸易额'},
                {source: '德国', target: '中国', weight: 80, name: '贸易额'},
                {source: '中国', target: '德国', weight: 70, name: '贸易额'}
            ],
            radius: ['50%', '70%'],
            focusNodeAdjacency: true,
            label: {
                show: true,
                position: 'right',
                textStyle: {
                    color: 'black'
                }
            },
            lineStyle: {
                color: 'source',
                curveness: 0.5
            }
        }
    ]
};
myChart.setOption(option);